 /**
 * Description: PAD管理
 * @author:yueyemoyan
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-05-14   yueyemoyan       1.0.0     Initial
 */
package com.metro.activation.biz.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.activation.biz.mapper.IBizPadManagementMapper;
import com.metro.activation.biz.service.inf.IBizPadManagementService;
import com.metro.activation.biz.beans.vo.BizPadManagement;

 /**
 * PAD管理<br>
 *
 * @author:yueyemoyan
 * @since:1.0.0
 * @version [1.0.0, 2018-05-14]
 */
@Service("bizpadmanagementService")
public class BizPadManagementService extends BaseServiceSupport<BizPadManagement> implements IBizPadManagementService{
    //PAD管理Mapper
    @Autowired
    private IBizPadManagementMapper bizpadmanagementMapper;

    @Override
    public IMapper getMapper() {
        return bizpadmanagementMapper;
    }

    @Override
    public IResult save(BizPadManagement entity) {
        try {
            bizpadmanagementMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增PAD管理失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(BizPadManagement entity) {
        try {
            bizpadmanagementMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改PAD管理失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            bizpadmanagementMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            bizpadmanagementMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

	@Override
	public IResult cancelByIds(String ids) {
		try {
            bizpadmanagementMapper.cancelByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("注销失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
	}
}